package com.elm.controller;

import java.io.IOException;


import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.elm.model.Seller;
import com.elm.service.SellerService;
import com.elm.serviceimpl.SellerServiceImpl;

public class UpdateSellerController extends HttpServlet{
	SellerService sellerservice=new SellerServiceImpl();
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
	// TODO Auto-generated method stub
	doPost(req, resp);
}
@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		// TODO Auto-generated method stub
	req.setCharacterEncoding("utf8");
	resp.setCharacterEncoding("utf8");
	HttpSession   session = req.getSession();
	Seller seller=(Seller) session.getAttribute("currentSeller");
	int sellerid=seller.getSellerid();
	String sellername=req.getParameter("sellername");
	String shopname=req.getParameter("shopname");
	String sellerphone=req.getParameter("sellerphone");
	String selleraddr=req.getParameter("selleraddr");
	String sellerpsw=req.getParameter("sellerpsw");
	String shopgenre=req.getParameter("shopgenre");
	Seller seller2=new Seller(sellername, shopname, sellerphone, selleraddr, sellerpsw, shopgenre);
	int flag=sellerservice.updateSeller(seller2, sellerid);
	}
}
